Discover gists
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const FORM_MANAGER = { | |
id: 'rule-form-manager', | |
initial: 'blank-form', | |
states: { | |
'blank-form': { | |
on: { | |
PICK_ADDRESS_FAMILY: [ | |
{ target: 'ipv4-address-any-port', cond: (_, { value }) => value === 'IP4' }, | |
{ target: 'ipv6-address-any-port', cond: (_, { value }) => value === 'IP6' }, | |
{ target: 'any-address-any-port', cond: (_, { value }) => value === 'ANY' }, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function createMachine() { | |
return Machine({ | |
id: 'example-form-manager', | |
type: 'parallel', | |
context: { | |
canSelectNone: true, | |
advancedProtocol: '', | |
ip4Address: '', | |
ip6Address: '' | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const parseScannedData = | |
(context, event) => { | |
return (callback) => { | |
// This should be something that gets the json: | |
let { json } = {} // doSomethingAsync(); | |
let isValid = Array.isArray(json); | |
if (!isValid) { | |
callback({ type: 'SCAN_ERROR' }); | |
} else { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import DS from 'ember-data'; | |
let id = 0; | |
function uniqId() { | |
id++; | |
return `${id}`; | |
} | |
export default DS.JSONAPIAdapter.extend({ | |
ajax(url, method, { data }) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lookupFactory(refName) { | |
// lookupMethod was moved to _lookupFactory in Ember 2.x+ | |
// This is a well used API in the community but was never officially made | |
// public. Core team is in the process of making an official API for | |
// factories. Till then this is the only way to lookup factories from the | |
// registry. https://github.com/emberjs/rfcs/pull/150 | |
const owner = getOwner(this); | |
const lookupFactory = owner._lookupFactory || owner.lookupFactory; | |
return lookupFactory.call(owner, refName); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" Vim syntax file | |
" Language: Slack | |
" Maintainer: Devin Weaver <suki@tritarget.org> | |
if exists("b:current_syntax") | |
finish | |
endif | |
syn case ignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function httpPromise(url, method, data) { | |
if (!data) { | |
data = method; | |
methos = 'GET'; | |
} | |
return new Promise(function(resolve, reject) { | |
var http = $tw.utils.httpRequest({ | |
url: url, | |
type: method, | |
data: data, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 7c7e8615860eb40da0e95ae41d9f750079ac9eb4 Mon Sep 17 00:00:00 2001 | |
From: Said <saidmoya12@gmail.com> | |
Date: Mon, 18 Apr 2016 14:45:03 -0500 | |
Subject: [PATCH] Resize with device orientation changes | |
When a mobile device changes orientation it does not trigger the | |
`resize` event like a normal window resize would. This means on mobile | |
devices that changing the orientation does not cause the pannellum | |
canvas to resize. This commit resizes based on the `orientationchange` | |
event. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
title: $:/core/templates/allpublictiddlers.template.html | |
type: text/vnd.tiddlywiki-html | |
<!-- This template is provided for backwards compatibility with older versions of TiddlyWiki --> | |
<$set name="exportFilter" value="[!is[system]!tag[private]sort[title]]"> | |
{{$:/core/templates/exporters/StaticRiver}} | |
</$set> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"crypto/hmac" | |
"crypto/sha512" | |
"fmt" | |
"log" | |
"math/rand" | |
"time" |
NewerOlder